/*
 * ClockSource.cpp
 *
 *   This is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Lesser General Public
 *   License as published by the Free Software Foundation; either
 *   version 2 of the License, or (at your option) any later version.
 *
 *   This software is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *   Lesser General Public License for more details.
 *
 *  Created on: 2010-1-2
 *      Author: Huang Haiyang
 */

#include "../ClockSource.h"

#include <e32std.h>
#include <hal.h>
#include <hal_data.h> 

namespace service
	{

	ClockSource::ClockSource()
		:iTickPeriod(initialSystemTickPeriod())
		{
		}

	TUint32 ClockSource::Ticks()
		{
		TUint32 currentTick;
		currentTick = User::TickCount();
		return currentTick;
		}
	
	TUint32 ClockSource::initialSystemTickPeriod()
		{
		TInt tickPeriod;		
		HAL::Get(HALData::ESystemTickPeriod, tickPeriod);
		//tickPeriod /= 1000;
		return tickPeriod;
		}
	}
